package com.platform.service.impl;

import com.platform.cache.J2CacheUtils;
import com.platform.util.Constants;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

import com.platform.dao.SmsTemplateDao;
import com.platform.entity.SmsTemplateEntity;
import com.platform.service.SmsTemplateService;

/**
 * Service实现类
 *
 * @author lipengjun
 * @email 939961241@qq.com
 * @date 2018-10-21 00:36:13
 */
@Service("smsTemplateService")
public class SmsTemplateServiceImpl implements SmsTemplateService {
    @Autowired
    private SmsTemplateDao smsTemplateDao;

    @Override
    public SmsTemplateEntity queryObject(Integer id) {
        return smsTemplateDao.queryObject(id);
    }

    @Override
    public List<SmsTemplateEntity> queryList(Map<String, Object> map) {
        return smsTemplateDao.queryList(map);
    }

    @Override
    public int queryTotal(Map<String, Object> map) {
        return smsTemplateDao.queryTotal(map);
    }

    @Override
    public int save(SmsTemplateEntity smsTemplate) {
        J2CacheUtils.clear(Constants.REDIS_SMS_TEMPLATE_KEY);
        return smsTemplateDao.save(smsTemplate);
    }

    @Override
    public int update(SmsTemplateEntity smsTemplate) {
        J2CacheUtils.clear(Constants.REDIS_SMS_TEMPLATE_KEY);
        return smsTemplateDao.update(smsTemplate);
    }

    @Override
    public int delete(Integer id) {
        J2CacheUtils.clear(Constants.REDIS_SMS_TEMPLATE_KEY);
        return smsTemplateDao.delete(id);
    }

    @Override
    public int deleteBatch(Integer[] ids) {
        J2CacheUtils.clear(Constants.REDIS_SMS_TEMPLATE_KEY);
        return smsTemplateDao.deleteBatch(ids);
    }
}
